Transaction feature generation

ABSTRACT

The present specification discloses a method and an apparatus for training a transaction feature generation model, and a method and an apparatus for generating a transaction feature. The method for generating a transaction feature can include the following: obtaining a target dataset, where the target dataset includes some pieces of transaction data; obtaining some original features of the transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of PCT Application No. PCT/CN2020/070847, filed on Jan. 8, 2020, which claims priority to Chinese Patent Application No. 201910457803.2, filed on May 29, 2019, and each application is hereby incorporated by reference in its entirety.

TECHNICAL FIELD

The present specification relates to the field of machine learning technologies, and in particular to a method and an apparatus for training a transaction feature generation model, and a method and an apparatus for generating a transaction feature.

BACKGROUND

In the field of machine learning technologies, features input into a machine learning model usually depend on artificial experience summary. It requires technicians to have a lot of prior knowledge, and a lot of time needs to be consumed for verification, causing low feature generation efficiency.

SUMMARY

The present specification provides a method and an apparatus for training a transaction feature generation model, and a method and an apparatus for generating a transaction feature.

The present specification is implemented by using the following technical solutions:

A method for generating a transaction feature is provided, where the transaction feature is used to identify an illegal transaction, and the method includes the following: obtaining a target dataset, where the target dataset includes some pieces of transaction data; obtaining some original features of the transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

A method for training a transaction feature generation model includes the following: obtaining a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction; obtaining some original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and training the transaction feature generation model based on the feature vector and the feature label of the new feature.

A feature generation method includes the following: obtaining a target dataset, where the target dataset includes some pieces of data; obtaining some original features of the data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as features generated for the target dataset.

An apparatus for generating a transaction feature is provided, where the transaction feature is used to identify an illegal transaction, and the apparatus includes the following: a dataset acquisition unit, configured to obtain a target dataset, where the target dataset includes some pieces of transaction data; a feature acquisition unit, configured to obtain some original features of the transaction data and determine one or more combination methods for the original features; a feature combination unit, configured to determine a feature vector of a new feature that is obtained by combining the original features based on each combination method; a feature prediction unit, configured to input the feature vector into a trained transaction feature generation model, and output a prediction result of the new feature; and a feature generation unit, configured to select some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

An apparatus for training a transaction feature generation model includes the following: a sample acquisition unit, configured to obtain a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction; a feature acquisition unit, configured to obtain some original features of the sample transaction data and determine one or more combination methods for the original features; a feature combination unit, configured to determine a feature vector of a new feature that is obtained by combining the original features based on each combination method; a difference calculation unit, configured to calculate a difference between the new feature and the transaction label as a feature label of the new feature; and a model training unit, configured to train the transaction feature generation model based on the feature vector and the feature label of the new feature.

An apparatus for generating a transaction feature includes the following: a processor; and a memory, configured to store a machine executable instruction, where by reading and executing a machine executable instruction that is stored in the memory and corresponds to generation logic of the transaction feature, the processor is enabled to perform the following operations: obtaining a target dataset, where the target dataset includes some pieces of transaction data; obtaining some original features of the transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

An apparatus for training a transaction feature generation model includes the following: a processor; and a memory, configured to store a machine executable instruction, where by reading and executing a machine executable instruction that is stored in the memory and corresponds to training logic of the transaction feature generation model, the processor is enabled to perform the following operations: obtaining a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction; obtaining some original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and training the transaction feature generation model based on the feature vector and the feature label of the new feature.

It can be seen from the previous description that, in some implementations, the original features of the data can be combined to obtain some new features, and then the trained feature generation model is used to predict the new features, and some new features whose prediction results meet the specified condition can be selected as the newly generated features for later data prediction, thereby automatically generating features and greatly improving feature generation efficiency.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic flowchart illustrating a method for training a transaction feature generation model, according to an example implementation of the present specification;

FIG. 2 is a schematic flowchart illustrating a method for generating a transaction feature, according to an example implementation of the present specification;

FIG. 3 is a schematic flowchart illustrating a feature generation method, according to an example implementation of the present specification;

FIG. 4 is a schematic structural diagram illustrating an apparatus for generating a transaction feature, according to an example implementation of the present specification;

FIG. 5 is a block diagram illustrating an apparatus for generating a transaction feature, according to an example implementation of the present specification;

FIG. 6 is a schematic structural diagram illustrating an apparatus for training a transaction feature generation model, according to an example implementation of the present specification; and

FIG. 7 is a block diagram illustrating an apparatus for training a transaction feature generation model, according to an example implementation of the present specification.

DESCRIPTION OF IMPLEMENTATIONS

Example implementations are described in detail here, and examples of the example implementations are presented in the accompanying drawings. When the following description relates to the accompanying drawings, unless specified otherwise, same numbers in different accompanying drawings represent same or similar elements. Implementations described in the following example implementations do not represent all implementations consistent with the present specification. On the contrary, the implementations are only examples of apparatuses and methods that are described in the appended claims in detail and consistent with some aspects of the present specification.

The terms used in the present specification are merely for illustrating specific implementations, and are not intended to limit the present specification. The terms “a” and “the” of singular forms used in the present specification and the appended claims are also intended to include plural forms, unless otherwise specified in the context clearly. It should be further understood that the term “and/or” used in the present specification indicates and includes any or all possible combinations of one or more associated listed items.

It should be understood that although terms “first”, “second”, “third”, etc. may be used in the present specification to describe various types of information, the information should not be limited by these terms. These terms are only used to differentiate between information of the same type. For example, without departing from the scope of the present specification, first information can also be referred to as second information, and similarly, the second information can also be referred to as the first information. Depending on the context, for example, the word “if” used here can be explained as “while”, “when”, or “in response to determining”.

According to the solutions for generating a transaction feature provided in the present specification, the original features of the transaction data can be combined to obtain some new features, and then the trained transaction feature generation model is used to predict the new features, and some new features whose prediction results meet the specified condition can be selected as the newly generated features for later illegal transaction identification, thereby automatically generating transaction features and greatly improving transaction feature generation efficiency.

The following separately describes the specific implementation process of the present specification from the perspective of training a transaction feature generation model and from the perspective of generating a transaction feature.

FIG. 1 is a schematic flowchart illustrating a method for training a transaction feature generation model, according to an example implementation of the present specification.

Referring to FIG. 1, the method for training a transaction feature generation model can include the following steps:

Step 102: Obtain a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction.

In the present implementation, transaction data for which illegal transaction identification has been performed can be obtained as sample transaction data with a transaction label. The transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction. The illegal transaction can include a cash-out transaction, a money laundering transaction, etc.

For example, the transaction label “0” can indicate that the corresponding sample transaction data is not an illegal transaction; the transaction label “1” can indicate that the corresponding sample transaction data is an illegal transaction, and so on.

In the present implementation, sample transaction data can be classified based on an application scenario, and sample transaction data in the same application scenario is classified into the same sample dataset.

A certain e-commerce platform is used as an example. Sample transaction data traded by using the e-commerce platform can be classified into sample dataset 1.

A certain consumer credit product is used as another example. Sample transaction data for which payment is made by using the consumer credit product can be classified into sample dataset 2.

In the present implementation, one or more sample datasets can be obtained, which is not specially limited in the present specification.

Step 104: Obtain some original features of the sample transaction data and determine one or more combination methods for the original features.

In the present implementation, the original features are features of the sample transaction data, such as a transaction amount, the number of transactions, a distance between a transaction location and a merchant, a merchant category, a user category, etc.

Types of different original features may be the same or different. For example, the type of the transaction amount is a numeric type, the type of the number of transactions is a numeric type, the type of the merchant category is a string, and the type of the user category is a string, and so on.

The numeric type can be subdivided into a floating-point type and an integer type.

The transaction amount is of the floating-point type, for example, the transaction amount is 108.75 yuan, and so on.

The number of transactions is of the integer type, for example, the number of transactions is 5, and so on.

The present specification does not impose a limitation on the classification of the types of the original features.

For example, the floating-point type and the integer type can be unified into the numeric type without distinction.

For another example, the floating-point type, the integer type, etc. can be used as the types of the original features, and the numeric type is not preserved.

In the present implementation, for ease of feature combination, when original features in the sample dataset are obtained, some original features of the same type can be obtained each time, and the number of the obtained original features can be 2, 3, etc., which is not specially limited in the present specification.

In an example, some original features of the same type can be obtained.

Original features of the floating-point type are used as an example. The original feature “total transaction amount of the user last month” and the original feature “total transaction amount of the user in the same period of last year” can be obtained.

Original features of the integer type are used as an example. The original feature “number of transactions on yesterday” and the original feature “number of transactions on the day before yesterday” can be obtained.

In other examples, when original features of different types can be combined, some original features of different types can be obtained.

For example, the original feature “total transaction amount in the past 30 days” of the floating-point type and the original feature “number of transactions in the past 30 days” of the integer type are obtained.

It is worthwhile to note that, when original features are obtained, if two original features cannot be combined, the two original features will not be obtained at the same time.

For example, the original feature “user category” of the string type and the original feature “number of transactions in the past 30 days” of the integer type will not be obtained at the same time because the two original features cannot be combined.

In the present implementation, for ease of description, some original features obtained each time can be referred to as one original feature group. In the present step, acquisition can be performed multiple times to obtain multiple original feature groups.

It is worthwhile to note that, in the present implementation, original features are usually obtained per sample dataset, and are not obtained across sample datasets. In other words, all original features in each original feature group come from the same sample dataset.

In the present implementation, for each obtained original feature group, a combination method that matches a type of original features can be determined for the original features in the original feature group.

Original features of the numeric type are used as an example. The combination method can include four arithmetic operations such as addition, subtraction, multiplication, and division, logarithmic sum calculation, quadratic sum calculation, and the like operation methods. The combination method can also be first sorting the original features in terms of magnitude, and then abstracting some original features based on the sorting result to perform four arithmetic operations, quadratic sum calculation, or the like operations, which is not specially limited in the present specification.

For example, assume that original features in a certain original feature group are “number of transactions on yesterday” and “number of transactions on the day before yesterday”. The combination method can be subtraction. For example, “number of transactions on yesterday” is subtracted by “number of transactions on the day before yesterday” to obtain a difference in the number of transactions.

Original features of the string type are used as an example. The combination method can be an operation on string lengths of the original features, for example, four arithmetic operations on the string lengths. For a specific operation method, references can be made to the combination method for the original features of the numeric type. Details are omitted here for simplicity.

Step 106: Determine a feature vector of a new feature that is obtained by combining the original features based on each combination method.

In the present implementation, for each original feature group obtained in step 104, one new feature can be obtained by combining the original features in the original feature group based on one combination method. Some new features can be obtained by combining the original features in various original feature groups based on various combination methods.

In the present step, a feature vector of each new feature can be determined.

In an example, original features in a sample dataset can be combined based on a combination method, and a value of a new feature obtained through the combination can be used as a feature vector of the new feature.

For example, assume that an original feature group obtained from a certain sample dataset includes two original features of the numeric type: original feature a and original feature b; the combination method is addition; there are 100 pieces of transaction data in total in the sample dataset; values of original feature a are respectively [a₁, a₂, . . . , a₁₀₀]; values of original feature b are respectively [b₁, b₂, . . . , b₁₀₀]. Original feature a and original feature b are combined by means of addition, and a feature vector of the obtained new feature a+b can be [a₁+b₁, a₂+b₂, . . . , a₁₀₀+b₁₀₀].

In another example, to reduce a computation amount, the feature vector of the new feature can also be generated based on meta information of the original features and the combination method.

The meta information of the original features can include an average value, a variance, and the number of unique data of the original features in the sample dataset. The meta information of each original feature can form one meta information vector.

A presentation form of the combination method can be a 0/1 vector (Onehot vector), or can be a low-dimension vector obtained by performing embedding processing on the 0/1 vector. The 0/1 vector means that a very long vector is used to represent the combination method. Dimensions of the vector are the total number of the combination methods, and each dimension corresponds to one unique combination method. If a certain combination method is used, an element value of a dimension of the combination method is 1. If a certain combination method is not used, an element value of a dimension of the combination method is 0.

Assume that there are 80 combination methods in total. The 0/1 vector of the combination methods has 80 dimensions, and each dimension corresponds to one unique combination method. The previous addition is still used as an example. In the 80-dimension 0/1 vector, an element value of the dimension corresponding to the addition is 1, and element values of other dimensions are all 0. To be specific, an element value of one element in the 80-dimension 0/1 vector is 1, and element values of the other 79 elements are all 0.

Original feature a and original feature b described above are still used as an example. A feature vector of a new feature can be generated based on a meta information vector of original feature a, a meta information vector of original feature b, and the 0/1 vector of the combination method. For simplicity, these three vectors can be spliced together to obtain the feature vector of the new feature.

In other examples, when there are multiple sample datasets, that is, when the number of sample datasets is greater than 1, the feature vector of the new feature can be generated based on the meta information of the original features, the combination method, and meta features of the sample datasets.

The meta features of the sample datasets can include a ratio (a ratio of positive and negative samples) of an amount of sample transaction data marked as legal transactions to an amount of sample transaction data marked as illegal transactions in the sample datasets, the number of original features, the number of original features of the numeric type, the number of original features of the string type, etc. The meta features of the sample datasets can form one meta feature vector.

In the present example, the meta information vector of the original features, the 0/1 vector of the combination method, and the meta feature vector of the sample datasets can be spliced together to obtain the feature vector of the new feature.

Step 108: Calculate a difference between the new feature and the transaction label as a feature label of the new feature.

In the present implementation, a smaller difference between the new feature obtained through the combination and the transaction label of each piece of sample transaction data can indicate a more reliable new feature obtained. Therefore, in the present example, the difference between the new feature and the transaction label is used as the feature label of the new feature.

In the present implementation, for each piece of sample transaction data in the sample dataset, the value of the new feature of each piece of sample transaction data can be calculated based on the combination method; and then a transaction label of the sample transaction data can be used as a real value, a mean square error between the value of the new feature of the sample transaction data and the real value can be calculated, and the mean square error can be used as the difference between the new feature and the transaction label.

In the present implementation, the feature label of the new feature can be calculated by using the following formula:

$C = \frac{{\Sigma_{1}^{N}\left( {{fab}_{i} - l_{i}} \right)}^{2}}{N}$

The combination of original feature a and original feature b is still used as an example. In the previous formula, C represents the feature label of the new feature ab, N represents the number of the sample transaction data in the sample dataset, fab_(i) represents a value of a new feature ab of an ith piece of sample transaction data, and l_(i) represents a transaction label of the ith piece of sample transaction data, where a value of i ranges from 1 to N.

In other examples, the difference between the new feature and the transaction label can also be calculated by using algorithms such as Euclidean distance and Mahalanobis distance, which is not specially limited in the present specification.

Step 110: Train the transaction feature generation model based on the feature vector and the feature label of the new feature.

Based on steps 106 and 108, the feature vector of the new feature can be input into the transaction feature generation model, and a prediction result of the new feature can be output. Then, a difference between the prediction result and the feature label of the new feature can be calculated, and parameters of the transaction feature generation model can be adjusted based on the difference to train the transaction feature generation model.

In the present implementation, a machine learning model under supervision can be used as the transaction feature generation model, such as a neural network model, which is not specially limited in the present specification.

FIG. 2 is a schematic flowchart illustrating a method for generating a transaction feature, according to an example implementation of the present specification.

Referring to FIG. 2, the method for generating a transaction feature can include the following steps:

Step 202: Obtain a target dataset, where the target dataset includes some pieces of transaction data.

In the present implementation, for a certain application scenario for which illegal transaction identification is needed, transaction data in the application scenario can be obtained to obtain a target dataset.

For example, transaction data for which illegal transaction identification has been performed in the scenario can be obtained to obtain a target dataset. Transaction data in the target dataset has a transaction label.

For another example, when illegal transaction identification has not been performed for the transaction data in the scenario, the transaction data without a transaction label in the scenario can also be obtained to obtain the target dataset, which is not specially limited in the present specification.

The illegal transaction can include a cash-out transaction, a money laundering transaction, etc.

Step 204: Obtain some original features of the transaction data and determine one or more combination methods for the original features.

In the present implementation, the original features are features of the transaction data in the target dataset, such as a transaction amount, the number of transactions, a distance between a transaction location and a merchant, a merchant category, etc.

In the present implementation, some original feature groups can be obtained from the target dataset, each original feature group includes some original features, and a combination method can be determined for original features in each original feature group.

For the method for obtaining the original features and the method for determining the combination method, references can be made to step 104 in the implementation shown in FIG. 1. Details are omitted here for simplicity.

Step 206: Determine a feature vector of a new feature that is obtained by combining the original features based on each combination method.

In the present implementation, for each original feature group obtained in step 204, one new feature can be obtained by combining the original features in the original feature group based on one combination method. Some new features can be obtained by combining the original features in all original feature groups based on various combination methods.

In the present step, a feature vector of each new feature can be determined.

In an example, original features in a sample dataset can be combined based on a combination method, and a value of a new feature obtained through the combination can be used as a feature vector of the new feature.

In another example, the feature vector of the new feature can also be generated based on meta information of the original features and the combination method.

In other examples, when there are multiple sample datasets that are used to train the transaction feature generation model, the feature vector of the new feature can be generated based on the meta information of the original features, the combination method, and meta features of the datasets.

The meta features of the datasets can include the number of original features, the number of original features of the numeric type, the number of original features of the string type, a ratio of positive and negative samples (if any), etc.

For a method for generating the previous feature vector, references can be made to the method for generating a feature vector described in step 106 in the implementation shown in FIG. 1. Details are omitted here for simplicity.

Step 208: Input the feature vector into a trained transaction feature generation model, and output a prediction result of the new feature.

Step 210: Select some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

In the present implementation, the feature vectors of all new features can be input into the trained transaction feature generation model, and the prediction results of the new features can be output, and then the new features can be sorted in ascending order of the prediction results. Calculation of the difference between the new feature and the transaction label by using the Euclidean distance algorithm is used as an example. A smaller prediction result indicates a smaller difference between the new feature and the transaction label, and a more reliable new feature.

In the present implementation, after the sorting, new features ranked in the first N positions can be selected as the new transaction features generated for the target dataset. A value of N can be predetermined.

In the present implementation, after the newly generated transaction features are determined for the target dataset, illegal transaction identification can be performed for the transaction data in the scenario that the target dataset belongs to, based on the newly generated transaction features.

It can be seen from the previous description that, in the present specification, the original features of the transaction data can be combined to obtain some new features, and then the trained transaction feature generation model is used to predict the new features, and some new features whose prediction results meet the specified condition can be selected as the newly generated transaction features for later illegal transaction identification, thereby automatically generating transaction features and greatly improving transaction feature generation efficiency.

The present specification further provides a feature generation method. New features used for result prediction can be automatically generated based on original features, thereby improving feature generation efficiency.

Referring to FIG. 3, the feature generation method can include the following steps:

Step 302: Obtain a target dataset, where the dataset includes some pieces of data.

In the present implementation, the target dataset is a dataset for generating a new feature. In different prediction tasks, the data in the target dataset may be different.

For example, in the task of illegal transaction identification, the data in the target dataset can be transaction data, and each piece of transaction data can include original features such as a transaction amount and the number of transactions.

For another example, in the task of commodity recommendation, the data in the target dataset can be user data, and each piece of user data can include original features such as the user's age, the user's gender, the user's purchase history, and the user's browsing history.

For another example, in the task of text classification, the data in the target dataset can be text data, and each piece of text data can include original features such as words and word frequencies included in the corresponding text.

For another example, in the task of risky user identification, the data in the target dataset can be user data, and each piece of user data can include original features such as the user's age, the user's gender, and the user's behavior trajectory.

Step 304: Obtain some original features of the data and determine one or more combination methods for the original features.

In the present implementation, some original features of the same type can be obtained from the original features of the data, and a combination method for these original features can be determined.

Certainly, in other examples, some original features of different types can also be obtained from the original features of the data, and a combination method for these original features can be determined.

For acquisition of the original features and determining of the combination method, references can be made to the acquisition of the original features and the determining of the combination method in the task of generating a transaction feature in the implementation shown in FIG. 2. Details are omitted here for simplicity.

Step 306: Determine a feature vector of a new feature that is obtained by combining the original features based on each combination method.

In the present implementation, for each original feature group obtained in step 304, one new feature can be obtained by combining the original features in the group based on one combination method. Some new features can be obtained by combining the original features in various groups based on various combination methods.

In the present step, a feature vector of each new feature can be determined.

For the method for determining the feature vector, references can be made to the implementation shown in FIG. 1 or FIG. 2. Details are omitted here for simplicity.

Step 308: Input the feature vector into a trained feature generation model, and output a prediction result of the new feature.

Step 310: Select some new features whose prediction results meet a specified condition as features generated for the target dataset.

In the present implementation, the feature generation model can be trained in the same method as the previous feature generation method to obtain a trained feature generation model.

In the training process, the difference between the new feature and the data label can be used as the feature label of the new feature, so as to adjust the parameters of the feature generation model.

For a specific training process, references can be made to the process of training the transaction feature generation model in the transaction feature generation scenario shown in FIG. 1. Details are omitted here for simplicity.

In the present implementation, the feature vectors of all new features can be input into the trained feature generation model, and the prediction results of the new features can be output. Some new features whose prediction results meet a specified condition can be selected for later result prediction for the data.

For example, assume that the prediction task is to perform risk identification for the user to identify a risky user.

One sample or a sample dataset with a user label can be first used to train the feature generation model, to obtain a trained feature generation model. The user label is used to mark whether the corresponding user is a risky user.

For example, the feature generation model can be trained by using sample dataset 1 in a first transaction scenario and sample dataset 2 in a second transaction scenario. Each piece of user data in sample dataset 1 and sample dataset 2 has a user label.

After the trained feature generation model is obtained, for a third transaction scenario for which risky user identification is needed, the target dataset can be obtained from the third transaction scenario. Then, the previous trained feature generation model is used to predict a new feature for the scenario. After the new feature is obtained through prediction, the new feature can be used to predict user data in the third transaction scenario, so as to predict whether the corresponding user is a risky user.

It can be seen from the previous description that, in some implementations, the original features of the data can be combined to obtain some new features, and then the trained feature generation model is used to predict the new features, and some new features whose prediction results meet the specified condition can be selected as the newly generated features for later data prediction, thereby automatically generating features and greatly improving feature generation efficiency.

Corresponding to the previous implementation of the method for generating a transaction feature, the present specification further provides an implementation of an apparatus for generating a transaction feature.

The implementation of the apparatus for generating a transaction feature in the present specification can be applied to a server. The apparatus implementation can be implemented by software, or can be implemented by hardware or a combination of software and hardware. For example, the apparatus implementation is implemented by software. A logical apparatus is formed when a processor of a server where the apparatus is located reads a corresponding computer program instruction in a non-volatile memory into the memory for running. In terms of hardware, FIG. 4 is a diagram of a hardware structure of a server in which an apparatus for generating a transaction feature is located, according to the present specification. In addition to the processor, memory, network interface, and non-volatile memory shown in FIG. 4, the server in which the apparatus is located in the implementation generally can further include other hardware based on an actual function of the server. Details are omitted here for simplicity.

FIG. 5 is a block diagram illustrating an apparatus for generating a transaction feature, according to an example implementation of the present specification.

Referring to FIG. 5, the apparatus 400 for generating a transaction feature can be applied to the server shown in FIG. 4. The apparatus 400 includes the following: a dataset acquisition unit 401, a feature acquisition unit 402, a feature combination unit 403, a feature prediction unit 404, and a feature generation unit 405.

The dataset acquisition unit 401 is configured to obtain a target dataset, where the target dataset includes some pieces of transaction data.

The feature acquisition unit 402 is configured to obtain some original features of the transaction data and determine one or more combination methods for the original features.

The feature combination unit 403 is configured to determine a feature vector of a new feature that is obtained by combining the original features based on each combination method.

The feature prediction unit 404 is configured to input the feature vector into a trained transaction feature generation model, and output a prediction result of the new feature.

The feature generation unit 405 is configured to select some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

Optionally, the feature acquisition unit 402 is configured to obtain some original features of the same type in the transaction data; and determine a combination method that matches the type as the combination method for the original features.

Optionally, when the type is a numeric type, the combination method includes one or more of the following: four arithmetic operations, logarithmic sum calculation, or quadratic sum calculation.

Optionally, when the type is a string, the combination method includes one or more of the following: four arithmetic operations of string lengths, a logarithmic sum of string lengths, or a quadratic sum of string lengths.

Optionally, the feature vector is generated based on meta information of the original features and the combination method.

Optionally, the meta information includes one or more of the following: an average value, a variance, or the number of unique data of the original features.

Optionally, when the number of sample datasets for training the transaction feature generation model is greater than 1, the feature vector is generated based on meta information of the original features, the combination method, and meta features of the datasets.

Optionally, the meta features of the datasets include one or more of the following: the number of original features, the number of original features of the numeric type, or a ratio of positive and negative samples.

Corresponding to the previous implementation of the method for training a transaction feature generation model, the present specification further provides an implementation of an apparatus for training a transaction feature generation model.

The implementation of the apparatus for training a transaction feature generation model in the present specification can be applied to a server. The apparatus implementation can be implemented by software, or can be implemented by hardware or a combination of software and hardware. For example, the apparatus implementation is implemented by software. A logical apparatus is formed when a processor of a server where the apparatus is located reads a corresponding computer program instruction in a non-volatile memory into the memory for running. In terms of hardware, FIG. 6 is a diagram of a hardware structure of a server in which an apparatus for training a transaction feature generation model is located, according to the present specification. In addition to the processor, memory, network interface, and non-volatile memory shown in FIG. 6, the server in which the apparatus is located in the implementation generally can further include other hardware based on an actual function of the server. Details are omitted here for simplicity.

FIG. 7 is a block diagram illustrating an apparatus for training a transaction feature generation model, according to an example implementation of the present specification.

Referring to FIG. 7, the apparatus 600 for training a transaction feature generation model can be applied to the server shown in FIG. 6. The apparatus 600 includes the following: a sample acquisition unit 601, a feature acquisition unit 602, a feature combination unit 603, a difference calculation unit 604, and a model training unit 605.

The sample acquisition unit 601 is configured to obtain a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction.

The feature acquisition unit 602 is configured to obtain some original features of the sample transaction data and determine one or more combination methods for the original features.

The feature combination unit 603 is configured to determine a feature vector of a new feature that is obtained by combining the original features based on each combination method.

The difference calculation unit 604 is configured to calculate a difference between the new feature and the transaction label as a feature label of the new feature.

The model training unit 605 is configured to train the transaction feature generation model based on the feature vector and the feature label of the new feature.

Optionally, the difference calculation unit 604 is configured to: for each piece of sample transaction data in the sample dataset, calculate a value of a new feature of the sample transaction data based on the combination method; and use a transaction label of the sample transaction data as a real value, calculate a mean square error between the value of the new feature of the sample transaction data and the real value, and use the mean square error as the difference between the new feature and the transaction label.

For an implementation process of functions and roles of each unit in the apparatus, references can be made to an implementation process of corresponding steps in the previous method. Details are omitted here for simplicity.

Because an apparatus implementation corresponds to a method implementation, for related parts, references can be made to related descriptions in the method implementation. The previously described apparatus implementation is merely an example. The units described as separate parts can or cannot be physically separate, and parts displayed as units can or cannot be physical units, can be located in one position, or can be distributed on multiple network units. Some or all of the modules can be selected depending on an actual demand to achieve the objectives of the solutions of the present specification. A person of ordinary skill in the art can understand and implement the implementations of the present specification without creative efforts.

The system, apparatus, module, or unit illustrated in the previous implementations can be implemented by using a computer chip or an entity, or can be implemented by using a product having a certain function. A typical implementation device is a computer, and the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, a game console, a tablet computer, a wearable device, or any combination of these devices.

Corresponding to the previous implementation of the method for generating a transaction feature, the present specification further provides an apparatus for generating a transaction feature. The apparatus includes the following: a processor; and a memory, configured to store a machine executable instruction. The processor and the memory are usually interconnected by using an internal bus. In other possible implementations, the device can further include an external interface to communicate with other devices or components.

In the present implementation, by reading and executing a machine executable instruction that is stored in the memory and corresponds to generation logic of the transaction feature, the processor is enabled to perform the following operations: obtaining a target dataset, where the target dataset includes some pieces of transaction data; obtaining some original features of the transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

Optionally, the obtaining some original features of the transaction data includes the following: obtaining some original features of the same type in the transaction data; and the determining a combination method for the original features includes the following: determining a combination method that matches the type as the combination method for the original features.

Optionally, when the type is a numeric type, the combination method includes one or more of the following: four arithmetic operations, logarithmic sum calculation, or quadratic sum calculation.

Optionally, when the type is a string, the combination method includes one or more of the following: four arithmetic operations of string lengths, a logarithmic sum of string lengths, or a quadratic sum of string lengths.

Optionally, the feature vector is generated based on meta information of the original features and the combination method.

Optionally, the meta information includes one or more of the following: an average value, a variance, or the number of unique data of the original features.

Optionally, when the number of sample datasets for training the transaction feature generation model is greater than 1, the feature vector is generated based on meta information of the original features, the combination method, and meta features of the datasets.

Optionally, the meta features of the datasets include one or more of the following: the number of original features, the number of original features of the numeric type, or a ratio of positive and negative samples.

Corresponding to the previous implementation of the method for training a transaction feature generation model, the present specification further provides an apparatus for training a transaction feature generation model. The apparatus includes the following: a processor; and a memory, configured to store a machine executable instruction. The processor and the memory are usually interconnected by using an internal bus. In other possible implementations, the device can further include an external interface to communicate with other devices or components.

In the present implementation, by reading and executing a machine executable instruction that is stored in the memory and corresponds to training logic of the transaction feature generation model, the processor is enabled to perform the following operations: obtaining a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction; obtaining some original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and training the transaction feature generation model based on the feature vector and the feature label of the new feature.

Optionally, the obtaining some original features of the sample transaction data includes the following: obtaining some original features of the same type in the sample transaction data; and the determining a combination method for the original features includes the following: determining a combination method that matches the type as the combination method for the original features.

Optionally, the calculating a difference between the new feature and the transaction label includes the following: for each piece of sample transaction data in the sample dataset, calculating a value of a new feature of the sample transaction data based on the combination method; and using a transaction label of the sample transaction data as a real value, calculating a mean square error between the value of the new feature of the sample transaction data and the real value, and using the mean square error as the difference between the new feature and the transaction label.

Corresponding to the previous implementation of the method for generating a transaction feature, the present specification further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, and the program is executed by a processor to perform the following steps: obtaining a target dataset, where the target dataset includes some pieces of transaction data; obtaining some original features of the transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; and selecting some new features whose prediction results meet a specified condition as transaction features generated for the target dataset.

Optionally, the obtaining some original features of the transaction data includes the following: obtaining some original features of the same type in the transaction data; and the determining a combination method for the original features includes the following: determining a combination method that matches the type as the combination method for the original features.

Optionally, when the type is a numeric type, the combination method includes one or more of the following: four arithmetic operations, logarithmic sum calculation, or quadratic sum calculation.

Optionally, when the type is a string, the combination method includes one or more of the following: four arithmetic operations of string lengths, a logarithmic sum of string lengths, or a quadratic sum of string lengths.

Optionally, the feature vector is generated based on meta information of the original features and the combination method.

Optionally, the meta information includes one or more of the following: an average value, a variance, or the number of unique data of the original features.

Optionally, when the number of sample datasets for training the transaction feature generation model is greater than 1, the feature vector is generated based on meta information of the original features, the combination method, and meta features of the datasets.

Optionally, the meta features of the datasets include one or more of the following: the number of original features, the number of original features of the numeric type, or a ratio of positive and negative samples.

Corresponding to the previous implementation of the method for training a transaction feature generation model, the present specification further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, and the program is executed by a processor to perform the following steps: obtaining a sample dataset, where the sample dataset includes some pieces of sample transaction data with a transaction label, and the transaction label is used to mark whether the corresponding sample transaction data is an illegal transaction; obtaining some original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on each combination method; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and training the transaction feature generation model based on the feature vector and the feature label of the new feature.

Optionally, the obtaining some original features of the sample transaction data includes the following: obtaining some original features of the same type in the sample transaction data; and the determining a combination method for the original features includes the following: determining a combination method that matches the type as the combination method for the original features.

Optionally, the calculating a difference between the new feature and the transaction label includes the following: for each piece of sample transaction data in the sample dataset, calculating a value of a new feature of the sample transaction data based on the combination method; and using a transaction label of the sample transaction data as a real value, calculating a mean square error between the value of the new feature of the sample transaction data and the real value, and using the mean square error as the difference between the new feature and the transaction label.

Specific implementations of the present specification are described above. Other implementations fall within the scope of the appended claims. In some situations, the actions or steps described in the claims can be performed in an order different from the order in the implementations and the desired results can still be achieved. In addition, the process depicted in the accompanying drawings does not necessarily need a particular execution order to achieve the desired results. In some implementations, multi-tasking and concurrent processing is feasible or can be advantageous.

The previous descriptions are merely example implementations of the present specification, but are not intended to limit the present specification. Any modification, equivalent replacement, or improvement made without departing from the spirit and principle of the present specification shall fall within the protection scope of the present specification. 

What is claimed is:
 1. A computer-implemented method for generating a transaction feature, wherein the transaction feature is used to identify an illegal transaction, the method comprising: obtaining a target dataset, wherein the target dataset comprises transaction data; obtaining original features of the transaction data and storing the original features as a first original feature group, wherein the original features comprise data of one or more types that can be combined; determining one or more combination methods for the original features of the first original feature group; obtaining a new feature by combining the original features of the first original feature group based on the one or more combination methods; generating a feature vector based on the new feature; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; generating one or more features and selecting the one or more features as transaction features based on a corresponding prediction result for each of the one or more features, wherein the one or more features comprise the new feature; and identifying one or more illegal transactions based on the transaction features.
 2. The method according to claim 1, wherein obtaining the original features of the transaction data comprises: obtaining the original features wherein two or more of the original features obtained from the transaction data are of a first data type; and wherein determining the one or more combination methods for the original features comprises: determining a combination method that matches the first data type as the combination method for the original features.
 3. The method according to claim 2, wherein when the first data type is a numeric type, the combination method comprises one or more of the following: an arithmetic operation, logarithmic sum calculation, or quadratic sum calculation.
 4. The method according to claim 2, wherein when the first data type is a string, the combination method comprises one or more of the following: an arithmetic operation of string lengths, a logarithmic sum of string lengths, or a quadratic sum of string lengths.
 5. The method according to claim 1, wherein the feature vector is generated based on meta information of the original features and the one or more combination methods.
 6. The method according to claim 5, wherein the meta information comprises one or more of the following: an average value, a variance, or a number of unique data of the original features.
 7. The method according to claim 1, wherein generating the feature vector comprises: generating the feature vector based on meta information of the original features, the one or more combination methods, and meta features of two or more sample datasets used to create the trained transaction feature generation model.
 8. The method according to claim 7, wherein the meta features of the two or more sample datasets comprise one or more of the following: a number of original features, a number of original features of a numeric type, or a ratio of positive and negative samples.
 9. The computer-implemented method of claim 1, wherein the trained transaction feature generation model comprises elements trained, in part, by: obtaining a sample dataset, wherein the sample dataset comprises sample transaction data with a transaction label, and the transaction label is used to mark whether corresponding sample transaction data is an illegal transaction; obtaining original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on the one or more combination methods; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and generating the trained transaction feature generation model based, in part, on the feature vector and the feature label of the new feature.
 10. The method according to claim 9, wherein obtaining the original features of the sample transaction data comprises: obtaining the original features of the same type in the sample transaction data; and the determining a combination method for the original features comprises: determining a combination method that matches the same type as the combination method for the original features.
 11. The method according to claim 9, wherein the calculating a difference between the new feature and the transaction label comprises: for each piece of sample transaction data in the sample dataset, calculating a value of a new feature of the sample transaction data based on the combination method; and using a transaction label of the sample transaction data as a real value, calculating a mean square error between the value of the new feature of the sample transaction data and the real value, and using the mean square error as the difference between the new feature and the transaction label.
 12. A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising: obtaining a target dataset, wherein the target dataset comprises transaction data; obtaining original features of the transaction data and storing the original features as a first original feature group, wherein the original features comprise data of one or more types that can be combined; determining one or more combination methods for the original features of the first original feature group; obtaining a new feature by combining the original features of the first original feature group based on the one or more combination methods; generating a feature vector based on the new feature; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; generating one or more features and selecting the one or more features as transaction features based on a corresponding prediction result for each of the one or more features, wherein the one or more features comprise the new feature; and identifying one or more illegal transactions based on the transaction features.
 13. The non-transitory, computer-readable medium of claim 12, wherein obtaining the original features of the transaction data comprises: obtaining the original features wherein two or more of the original features obtained from the transaction data are of a first data type; and wherein determining the one or more combination methods for the original features comprises: determining a combination method that matches the first data type as the combination method for the original features.
 14. The non-transitory, computer-readable medium of claim 12, wherein the trained transaction feature generation model comprises elements trained, in part, by: obtaining a sample dataset, wherein the sample dataset comprises sample transaction data with a transaction label, and the transaction label is used to mark whether corresponding sample transaction data is an illegal transaction; obtaining original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on the one or more combination methods; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and generating the trained transaction feature generation model based, in part, on the feature vector and the feature label of the new feature.
 15. The non-transitory, computer-readable medium of claim 14, wherein obtaining the original features of the sample transaction data comprises: obtaining the original features of the same type in the sample transaction data; and the determining a combination method for the original features comprises: determining a combination method that matches the same type as the combination method for the original features.
 16. The non-transitory, computer-readable medium of claim 14, wherein the calculating a difference between the new feature and the transaction label comprises: for each piece of sample transaction data in the sample dataset, calculating a value of a new feature of the sample transaction data based on the combination method; and using a transaction label of the sample transaction data as a real value, calculating a mean square error between the value of the new feature of the sample transaction data and the real value, and using the mean square error as the difference between the new feature and the transaction label.
 17. A computer-implemented system, comprising: one or more computers; and one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform one or more operations comprising: obtaining a target dataset, wherein the target dataset comprises transaction data; obtaining original features of the transaction data and storing the original features as a first original feature group, wherein the original features comprise data of one or more types that can be combined; determining one or more combination methods for the original features of the first original feature group; obtaining a new feature by combining the original features of the first original feature group based on the one or more combination methods; generating a feature vector based on the new feature; inputting the feature vector into a trained transaction feature generation model, and outputting a prediction result of the new feature; generating one or more features and selecting the one or more features as transaction features based on a corresponding prediction result for each of the one or more features, wherein the one or more features comprise the new feature; and identifying one or more illegal transactions based on the transaction features.
 18. The computer-implemented system of claim 17, wherein obtaining the original features of the transaction data comprises: obtaining the original features wherein two or more of the original features obtained from the transaction data are of a first data type; and wherein determining the one or more combination methods for the original features comprises: determining a combination method that matches the first data type as the combination method for the original features.
 19. The computer-implemented system of claim 17, wherein the trained transaction feature generation model comprises elements trained, in part, by: obtaining a sample dataset, wherein the sample dataset comprises sample transaction data with a transaction label, and the transaction label is used to mark whether corresponding sample transaction data is an illegal transaction; obtaining original features of the sample transaction data and determining one or more combination methods for the original features; determining a feature vector of a new feature that is obtained by combining the original features based on the one or more combination methods; calculating a difference between the new feature and the transaction label as a feature label of the new feature; and generating the trained transaction feature generation model based, in part, on the feature vector and the feature label of the new feature.
 20. The computer-implemented system of claim 19, wherein obtaining the original features of the sample transaction data comprises: obtaining the original features of the same type in the sample transaction data; and the determining a combination method for the original features comprises: determining a combination method that matches the same type as the combination method for the original features. 